package main.flex.skin
{
	import flash.display.GradientType;
	import flash.display.Graphics;
	
	import main.flex.conf.MainConf;
	
	import mx.controls.Alert;
	import mx.skins.ProgrammaticSkin;

	public class HeaderWallpaperSkin extends ProgrammaticSkin
	{
		private var _baseColor : int;
		private var _darkColor : int;
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth,unscaledHeight);
			var w : Number = unscaledWidth;
			var h : Number = unscaledHeight;
			
			var g : Graphics = graphics;
			
			//Alert.show( "Wallpaper skin :: "+name );
			switch ( name )
			{
				default:
					_baseColor 		= MainConf.COLOR_BASE_GREY;
					_darkColor 		= MainConf.COLOR_BASE_GREY;
					break;
			}
			
			g.beginGradientFill(
									GradientType.LINEAR,
									[
									_baseColor,
									_darkColor
									],
									[
									( ( name == "focus" ) ? 0 : 1 ),
									( ( name == "focus" ) ? 0 : 1 )
									],
									[
									.1,
									.6
									]
									);
			g.moveTo( 
						MainConf.ELLIPSE_ACCOUNT_BUTTON,
						0
						);
			g.lineTo( 
						( w - MainConf.ELLIPSE_ACCOUNT_BUTTON ),
						0
						);
			g.curveTo(
						w,
						0,
						w,
						( h / 2 )
						);
			g.curveTo(
						w,
						h,
						( w - MainConf.ELLIPSE_ACCOUNT_BUTTON ),
						h
						);
			g.lineTo(
						0,
						h
						);
			g.curveTo(
						( MainConf.ELLIPSE_ACCOUNT_BUTTON / 2 ),
						h,
						( MainConf.ELLIPSE_ACCOUNT_BUTTON / 2 ),
						( h / 2 )
						);
			g.curveTo(
						( MainConf.ELLIPSE_ACCOUNT_BUTTON / 2 ),
						0,
						0,
						0
						);
			g.endFill();
		}
		
	}
}